Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support topic-level max message size #8732

Merged
merged 2 commits into from
Nov 30, 2020
Merged

Conversation

315157973
Copy link
Contributor

@315157973 315157973 commented Nov 27, 2020

fix https://github.com/streamnative/pulsar/issues/1723

Motivation

The current policy to control the size of the message is at the broker level(maxMessageSize). It becomes easier to plan resource quotas for client allocation if the max message size pushed can be given at the topic level.

Modifications

Now the broker-level maxMessageSize is returned by the broker to the client, when the broker handles handleConnected. The client will cached maxMessageSize locally. An exception will be thrown if it exceeds the limit.

Topic-level cannot be implemented like this, because:

  1. When handleConnected, the command received by the broker does not contain specific topic information, so it is not known which topic policy to return to the client.
  2. The client cannot cache topic-level policy. Unlike the broker-level policy, which will not change, the topic-level policy will change dynamically, which will involve cache consistency issues.

I think the best way to handle this is to let the broker determine whether it exceeds the limit, and return an exception if it exceeds the limit, and handle the exception by the client's handleSendError.

Verifying this change

TopicPoliciesTest.java

@315157973
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@315157973
Copy link
Contributor Author

/pulsarbot run-failure-checks

@sijie sijie added this to the 2.8.0 milestone Nov 30, 2020
@sijie sijie added the doc-required Your PR changes impact docs and you will update later. label Nov 30, 2020
@codelipenghui codelipenghui merged commit 9c28378 into apache:master Nov 30, 2020
@codelipenghui
Copy link
Contributor

/pulsarbot cherry-pick to branch-2.7

github-actions bot pushed a commit that referenced this pull request Nov 30, 2020
fix https://github.com/streamnative/pulsar/issues/1723

### Motivation
The current policy to control the size of the message is at the broker level(maxMessageSize). It becomes easier to plan resource quotas for client allocation if the max message size pushed can be given at the topic level.

### Modifications

Now the broker-level `maxMessageSize` is returned by the broker to the client, when the broker handles `handleConnected`. The client will cached `maxMessageSize` locally. An exception will be thrown if it exceeds the limit.

Topic-level cannot be implemented like this, because:
1) When `handleConnected`, the command received by the broker does not contain specific topic information, so it is not known which topic policy to return to the client.
2) The client cannot cache topic-level policy. Unlike the broker-level policy, which will not change, the topic-level policy will change dynamically, which will involve cache consistency issues.

I think the best way to handle this is to let the broker determine whether it exceeds the limit, and return an exception if it exceeds the limit, and handle the exception by the client's `handleSendError`.

### Verifying this change
TopicPoliciesTest.java

(cherry picked from commit 9c28378)
codelipenghui added a commit that referenced this pull request Dec 2, 2020
fix https://github.com/streamnative/pulsar/issues/1723

### Motivation
The current policy to control the size of the message is at the broker level(maxMessageSize). It becomes easier to plan resource quotas for client allocation if the max message size pushed can be given at the topic level.

### Modifications

Now the broker-level `maxMessageSize` is returned by the broker to the client, when the broker handles `handleConnected`. The client will cached `maxMessageSize` locally. An exception will be thrown if it exceeds the limit.

Topic-level cannot be implemented like this, because:
1) When `handleConnected`, the command received by the broker does not contain specific topic information, so it is not known which topic policy to return to the client.
2) The client cannot cache topic-level policy. Unlike the broker-level policy, which will not change, the topic-level policy will change dynamically, which will involve cache consistency issues.

I think the best way to handle this is to let the broker determine whether it exceeds the limit, and return an exception if it exceeds the limit, and handle the exception by the client's `handleSendError`.

### Verifying this change
TopicPoliciesTest.java

(cherry picked from commit 9c28378)

Co-authored-by: feynmanlin <feynmanlin@tencent.com>
@codelipenghui codelipenghui added the cherry-picked/branch-2.7 Archived: 2.7 is end of life label Dec 2, 2020
@315157973 315157973 deleted the msgSize branch December 9, 2020 09:16
@Anonymitaet Anonymitaet removed the doc-required Your PR changes impact docs and you will update later. label Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked/branch-2.7 Archived: 2.7 is end of life release/2.7.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Policy/config to limit the message size at topic level
4 participants